﻿// © 2009 Microsoft Corporation.  All rights reserved.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.InformationSecurity.RiskManagement.ISRMWeb.RiskService;
using Microsoft.Security.Application;

namespace Microsoft.InformationSecurity.RiskManagement.ISRMWeb.AppPages
{
    public partial class RiskTracker : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                RiskService.ManageRiskClient riskServiceClient = new RiskService.ManageRiskClient();
                RiskService.GeneralStats grpStats = riskServiceClient.GetGeneralStats();
                riskServiceClient.Close();

                // Assign the value.
                lbltotalRisk30Value.Text = AntiXss.HtmlEncode(grpStats.TotalNewRiskInLast30Days.ToString());
                lbltotalRisk7Value.Text = AntiXss.HtmlEncode(grpStats.TotalNewRiskInLast7Days.ToString());
                lbltotalRiskActive.Text = AntiXss.HtmlEncode(grpStats.TotalActiveRisk.ToString());
                lbltotalRiskValue.Text = AntiXss.HtmlEncode(grpStats.TotalRiskInSystem.ToString());
                lbltotalTasks30Value.Text = AntiXss.HtmlEncode(grpStats.TotalNewInLastTasks30Days.ToString());
                lbltotalTasks7Value.Text = AntiXss.HtmlEncode(grpStats.TotalNewInLastTasks7Days.ToString());
            }
        }
    }
}
